import Vue from 'vue'
export default {
    getCurrentUser(state){
        if (state.currentUser && Object.keys(state.currentUser).length > 0) {
            return state.currentUser
        }
        let user4Encode = window.localStorage.getItem(Vue.prototype.CURRENTUSER)
        if (!user4Encode || user4Encode == 'null') {
            user4Encode = Cookie.getCookie(Vue.prototype.CURRENTUSER);
        }
        return user4Encode ? JSON.parse(window.decodeURIComponent(user4Encode)) : null;

        let sessionCartMoudleMsg = window.sessionStorage.getItem('sessionCartModuleMsg') ? window.sessionStorage.getItem('sessionCartModuleMsg') : {};
        state.cartMoudleMsg = Object.assign({},state.cartMoudleMsg,sessionCartMoudleMsg);
        return state.cartMoudleMsg;
    },
}